package app.controller.display
{
	import app.DefaultPaths;
	import app.model.proxies.InProxy;
	import app.view.mediators.AirShellMediator;
	
	import mx.core.Container;
	import mx.modules.ModuleLoader;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
	
	import uk.co.revisual.core.CoreModule;

	public class PopulateModuleCmd extends SimpleCommand
	{
		override public function execute(note:INotification):void{
			var loader:ModuleLoader = ModuleLoader(note.getBody().target),
				module:CoreModule = CoreModule( loader.child ),
				inProxy:InProxy = InProxy( facade.retrieveProxy( InProxy.NAME ) );
				
			module.data = {	prefs: inProxy.getDataAtURL( DefaultPaths.MODULE_PREFS ),
							pivot: inProxy.getDataAtURL( DefaultPaths.MODULE_PIVOT ) };
			
			facade.removeCommand( AirShellMediator.LOAD_MODULE_READY );
		}
		
	}
}